package com.cdatos.golGana.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import com.cdatos.golGana.model.base.PersistentEntity;

@SuppressWarnings("serial")
@Entity
@Table(name = "ROL", uniqueConstraints = {
		@UniqueConstraint(columnNames = "sigla"),
		@UniqueConstraint(columnNames = "rol") })
public class Rol extends PersistentEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
	@Column(name = "ROL", unique = true, nullable = false)
	private String rol;

	@Column(name = "SIGLA", unique = true, nullable = false, length = 50)
	private String sigla;

	public Rol() {
	}

	public Rol(String sigla, String rol) {
		this.sigla = sigla;
		this.rol = rol;
	}
	public String getRol() {
		return this.rol;
	}
	public void setRol(String rol) {
		this.rol = rol;
	}
	public String getSigla() {
		return this.sigla;
	}
	public void setSigla(String sigla) {
		this.sigla = sigla;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Long getId() {
		return id;
	}
	
	@Override
	public boolean equals(Object obj) {
		return this.sigla.equals(((Rol) obj).getSigla());
	}
	
	
}
